package org.ncibi.cytoscape.metscape.multidisplay;

import java.util.HashMap;

public class Compound {

	private String label;
	
	private HashMap<Study,HashMap<TimeSeriesPosition,TypedValue>> map = new HashMap<Study,HashMap<TimeSeriesPosition,TypedValue>>();
	
	public Compound(String compoundLabel) {
		label = compoundLabel;
	}

	public String getLabel() {
		return label;
	}

	public void addValue(Study study, TimeSeriesPosition ts, TypedValue value) {
		HashMap<TimeSeriesPosition,TypedValue> valuesForTsLabel = map.get(study);
		if (valuesForTsLabel == null){
			valuesForTsLabel = new HashMap<TimeSeriesPosition,TypedValue>();
			map.put(study, valuesForTsLabel);
		}
		valuesForTsLabel.put(ts,value);
		study.updateMinMax(value.getValue());
	}

	public TypedValue getValue(Study study, TimeSeriesPosition ts){
		HashMap<TimeSeriesPosition,TypedValue> valuesForTsLable = map.get(study);
		if (valuesForTsLable == null) return null;
		return valuesForTsLable.get(ts);
	}
		
}
